home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ShareWare OnLine 2
/
ShareWare OnLine Volume 2 (CMS Software)(1993).iso
/
elecmail
/
cs_mac07.zip
/
ACTION.MAC
next >
Wrap
Text File
|
1993-03-28
|
12KB
|
311 lines
┌────────────────────────────────┐
│ Chuck Seyboldt's COMMO Macro │ CS-MAC07:ACTION.MAC
└────────────────────────────────┘
┌──────────────────────────────────┐
┌───┤ COMMO "ACTION processor" macro ├───
└──────────────────────────────────┘
*
* ACTION.MAC reads simple ASCII files and sends commands and
* strings to the BBS based on the ACTION file. Setup for PCBoards.
*
* You may make an ACTION file manually with a text editor.
* An ACTION file generator is included later as the :alf macro command.
* Located in the COMMO home dir, the ACTION file has this sort of format:
*
*┌─────────────────────────────── action.nl ─┐
*│ u │ < "U" for upload
*│ filename.ul │ < Name the file to u/l
*│ A line of file desription. Up to 45 chars │ < decription
*│ in length. Multiple line descriptions are │
*│ supported if your BBS host allows them. │
*│ -- │ < "--" to end ACTION item
*│ d │ < "D" for download
*│ file1.dl │ < batch downloads allowed
*│ another.zip │
*│ filemore.lhz │
*│ -- │ < "--" is important
*│ u │
*│ another.zip │
*│ /Private to the sysop. Thanks for the fish │
*│ -- │ < Esp. at the very end.
*└─────────────────────────────────────────────┘
*
{:action}
{sete-P0 esc}
{ifex %_hom%action.%abbr,,esc}
{rope %_hom%action.%abbr,act-end} <- START here
{:reread}
{pops-c}
{setl 60,,10,|}
{read cmd} ;read line of ACTION file
{comp cmd,--} {ifco reread} ;branch to appropriate ACTION
{comp cmd,a} {ifco asciup}
{comp cmd,j} {ifco joincn}
{comp cmd,d} {ifco dlfile}
{comp cmd,u} {ifco ulfile} ;if no match, end ACTION
{:act-end} ;When at end of ACTION list
{exec-n echo ^j*-*-* %_dat %_tim >> %savedir\used-act.%abbr}
{exec-n type %_hom%action.%abbr >> %savedir\used-act.%abbr}
{exec-n del %_hom%action.%abbr}
{setv line} {setv fname} {setv cmd}
{:esc} {macl logon.mac,noact} <- END here
┌──────────────────────────────┐
│ Download processor section │
└──────────────────────────────┘
{:dlfile}
{send %cmd%|} ;Setup is for Zmodem BATCH downloads
{golo skip,not avai} ;If host doesn't allow d/l, skip it
{:next-d}{read fname} ;Read one complete line into %fname%
{inst fname,--} {ifco do-dl}
{ifex %dldir\%fname,next-d} ;Don't try to d/l files that exist
{send %fname%~~~|} ;Send filename to BBS
{goto next-d} ;Repeat read til dl-list is all read
{:do-dl}{send |~~|} ;Start download
{call dlfile-%prot} ;call file download subroutine
{look %bbs_pmt}
{goto reread} ;end of "D" ACTION processor
┌────────────────────────────┐
│ Upload processor section │
└────────────────────────────┘
{:ulfile}
{read fname} ;Upload ACTION starts
{ifex %uldir\%fname,,skip} ;Make sure file exists on your disk
{send u %fname% %prot|} ;Tell host to get ready for u/l
{golo skip,Insufficient} ; disk space for complete upload!
{golo skip,not avai} ;If host doesn't allow u/l, or
{golo skip,y exists} ;If host says file already exists,
{golo skip,plicates} ; skip this u/l action item.
{look ximum)} ;Host is ready for description.
{:desc} {read line}
{comp line,--} ;Check for end of u/l action
{ifco ul_ok}
{send ~%line%|} ;Send description line
{goto desc} ;and look for more description
{:ul_ok}{send ~|}
{call ulfile-%prot} ;call file transfer subroutine
{setl 60,,30,|} ;Allow time for file validation
{look %bbs_pmt}
{goto reread} ;end of "U" ACTION processor
┌────────────────────────────┐
│ Skip to next action item │
└────────────────────────────┘
{:skip} {read line} ;SKIP section jumps to next
{comp line,--} ; action item by reading to
{ifco ,skip} ; the next "--" string.
{send |}
{setl 50,,3,|}
{look %bbs_pmt}
{goto reread} ;alternate end of "U" processor
* ASCII uploads take a special form. Here is an example message.
* You may need to structure ASCII upload messages differently.
*
*┌────────────────────────────────── hijack ──┐
*│ jack kilday │ < Message Recipient
*│ Thanks for the Fish │ < Message Subject
*│ n │ < Public/Private msg flag
*│ u │ < Use ASCII u/l, not editor
*│ Hi Jack, │
*│ │
*│ Just stopping in with a test of a COMMO │
*│ ACTION macro processor. I also wanted to │
*│ give you a big THANK YOU for all the fish. │
*│ They were delicious. │
*│ │
*│ Chuck·S │
*└─────────────────────────────────────────────┘
*
{:asciup}
{read fname} ;ASCII upload to PCBoard system
{ifex %dldir\%fname%,,reread}
{parm ,,,,2} ;Set character pacing
{send e|} ;Send "E" to start message entry
{asci %dldir\%fname%,} ;Send the structured message
{parm ,,,,0} ;No character pacing
{send ~~|~~~sn|} ;the PCBoard "save" command
{look %bbs_pmt}
{goto reread} ;end of "A" processor
┌───────────────────────────┐
│ Join conference section │
└───────────────────────────┘
{:joincn}
{read fname} ;Join PCBoard Conference
{send j %fname|}
{push}
{golo n|,)=yes?} ;Skip mail scan
{golo |,invalid} ;If you choose invalid conf
{golo n|,(H)elp} ;If you chose invalid conf
{golo 0|,none?} ;To conf 0 on invalid conf
{look %bbs_pmt} {pops}
{goto reread} ;end of "J" processor
┌───────────────────────────────────┐
└───┤ End Of "ACTION processor" macro ├───────
└───────────────────────────────────┘
┌─────────────────────────────┐
┌───┤ "ACTION generator" macro ├───
└─────────────────────────────┘
*
* This macro uses PKUNZIP to automatically insert the file
* description from a DESC.SDI or a FILE_ID.DIZ that might be
* found in a ZIP file.
*
* This macro isn't commented. It is pretty easy to follow.
{:alf} {sete-p0 icmnd}
{inpu abbr,Make ^(ACTION^) file: What BBS?} <- START Here
{comp abbr} {ifco opena}
{subs abbr,1,2,%abbr}
{:opena}{wope-a %_hom%action.%abbr}
{:icmnd}{setv cmd} {setv fname} {setv line}
{inpu cmd,^(U^)pload, ^(D^)ownload, ^(A^)scii Upload, ^(J^)oin Conf?}
{comp cmd,u} {ifco makeul}
{comp cmd,d} {ifco makedl}
{comp cmd,a} {ifco makeau}
{comp cmd,j} {ifco makejn}
{comp cmd} {ifco ,icmnd}
{wclo} {edit %_hom%action.%abbr}
{rope %_hom%action.%abbr}
{read line} {rclo} ;check for empty
{comp line} {ifco ,no_del} ;ACTION file
{exec-n del %_hom%action.%abbr} ;delete if empty
{:no_del}
{setv cmd} {setv fname} {setv line}
{comp mt} {ifco ,menu}
{macl %_mac} <- END Here
{:menu} {macl cs-mac.mac,clect} <- or here
{:makejn}
{inpu fname,Name or Number of Conference to Join}
{comp fname} {ifco icmnd}
{writ j}
{writ %fname}
{writ --} {goto icmnd}
{:makeau}
{inpu fname,Name the ASCII Upload}
{comp fname} {ifco icmnd}
{ifex %dldir\%fname,,makeau}
{writ a}
{writ %fname}
{writ --} {goto icmnd}
{:makedl}
{setv fname} {setv count,1}
{inpu fname,Name a File that you want to DownLoad}
{comp fname} {ifco icmnd}
{writ d}
{:dlmore}
{writ %fname}
{incr count} {setv fname}
{inpu fname,File #%count% to Download?}
{comp fname} {ifco ,dlmore}
{writ --} {goto icmnd}
{:makeul}
{inpu fname,Name the file to upload}
{comp fname} {ifco icmnd}
{ifex %dldir\%fname,descul,makeul}
{:descul}
{exec-d %pk_un -v %dldir\%fname desc.sdi file_id.diz}
{ifer 1,,diz_dsc}
{setv count,1}
{setv line}
{inpu line,One line description of %fname% Required}
{comp line} {ifco icmnd}
{writ u} {write %fname}
{writ %line} {incr count}
{:mdesc}{setv line} {inpu line,Line %count% of %fname% description}
{comp line} {ifco endul}
{writ %line} {incr count}
{goto mdesc}
{:endul}{writ --} {goto icmnd}
{:diz_dsc}
{writ u} {write %fname}
{setv file,file_id.diz}
{:add_dsc}
{exec-d %pk_un -v %uldir\%fname %file}
{ifer 1,chk_sdi}
{exec-n %pk_un -o %uldir\%fname %ramdr\ %file}
{rope %ramdr\%file,endul}
{:diz_lp}
{read line}
{writ %line}
{goto diz_lp}
{:chk_sdi}
{setv file,desc.sdi}
{goto add_dsc}
┌───────────────────────────────────┐
└───┤ End Of "ACTION generator" macro ├───────
└───────────────────────────────────┘
┌──────────────────────────────────────┐
│ File Transfer protocol subroutines │
└──────────────────────────────────────┘
*
* This arrangement provides a method to easily expand the file
* transfer protocols that one might use.
┌──────────┐
│ Zmodem │
└──────────┘
{:ulfile-z}
{:ulfile-} ;default protocol is "Z"
{look ^xB01} ;Zmodem .REP Upload
{exec-n %z_prog port %_por ha bo sz -m %uldir\%fname}
{retu}
{:dlfile-z}
{:dlfile-} ;default protocol is "Z"
{push}
{golo reread,%bbs_pmt} ;if no filenames matched
{golo n|,ed? [} ;Wildcat logoff after transfer
{golo z|,] ? [} ;Wildcat protocol select
{look ^xB00}
{pops}
{exec-n %z_prog port %_por ha bo rz -mr %dldir}
{golo reread,] ? [} ;At Wildcat File Menu
{retu}
┌──────────┐
│ Ymodem │
└──────────┘
{:ulfile-y} ;Ymodem File Upload
{paus 10}
{symo-k %uldir\%fname}
{retu}
{:dlfile-y} ;Ymodem File Download
{paus 10}
{rymo-y %dldir} ;overwrite exiting files
{retu}
┌──────────┐
│ Xmodem │
└──────────┘
{:ulfile-x} ;Xmodem File Upload
{paus 10}
{sxmo-y %uldir\%fname}
{retu}
{:dlfile-x} ;Xmodem File Download
{paus 10}
{send g}
{rxmo-y %dldir\%fname}
{retu}